package com.jingtai.platform.controller.pay;

import com.jingtai.core.entity.pay.PayOrder;
import com.jingtai.platform.service.pay.PayOrderService;
import com.jingtai.platform.util.ResultUtil;
import io.swagger.annotations.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import com.jingtai.validate.swagger.CApiParam;

/**
 * 支付订单表
 *
 * @author sunlaiqian
 * @date 2020-12-02 18:31:32
 */
@Validated
@RestController
@RequestMapping("/platform/payorder")
@Api(tags = "支付订单表")
public class PayOrderController{

    @Autowired
    private PayOrderService payOrderService;


    @ApiOperation("支付订单表列表查询")
    @GetMapping("/list")
    public ResultUtil aopPayOrderList(@CApiParam(name = "page",value = "页数",required = true,cNotEmpty = true,cIntMin = 1) @RequestParam("page") Integer page,
                              @CApiParam(name = "limit",value = "每页个数",required = true,cNotEmpty = true,cIntMin = 1) @RequestParam("limit") Integer limit,
                              @CApiParam(name = "conditions",value = "查询条件",required = false) @RequestParam("conditions") String conditions){
        return payOrderService.PayOrderlist(page, limit, conditions);
    }


    @ApiOperation("根据ID查询payOrder实体")
    @GetMapping("/getPayOrderById")
    public ResultUtil GetPayOrderById(@CApiParam(name = "id",value = "payOrder实体ID",required = true,cNotEmpty = true) @RequestParam("id") Long id){
        return payOrderService.getPayOrderById(id);
    }


    @ApiOperation("新增payOrder实体")
    @PostMapping("/add")
    @ApiOperationSupport(ignoreParameters = {"payOrder.id","payOrder.createTime","payOrder.updateTime","payOrder.deleteFlag"})
    public ResultUtil aopAddPayOrder(@RequestBody @Validated PayOrder payOrder){
        return payOrderService.addPayOrder(payOrder);
    }

    @ApiOperation("编辑payOrder实体")
    @PostMapping("/edit")
    @ApiOperationSupport(ignoreParameters = {"payOrder.createTime","payOrder.updateTime","payOrder.deleteFlag"})
    public ResultUtil aopEditPayOrder(@RequestBody @Validated PayOrder payOrder){
        return payOrderService.editPayOrder(payOrder);
    }

    @ApiOperation("根据ID删除payOrder实体")
    @GetMapping("/delPayOrderById")
    public ResultUtil aopDelPayOrderById(@CApiParam(name = "id",value = "payOrder实体ID",required = true,cNotEmpty = true) @RequestParam("id") Long id){
        return payOrderService.delPayOrderById(id);
    }

}






